﻿@{
    ViewBag.Title = "添加投诉";
    Layout = "~/Views/Shared/_FlowForm.cshtml";
}
<script src="~/Content/scripts/jquery/layer/jquery.js?v=1.83.min"></script>
<script src="~/Content/scripts/jquery/layer/layer.min.js"></script>
<link href="~/Content/styles/font-awesome.min.css" rel="stylesheet" />
<link href="~/Content/styles/BillDetail.css?v=1.1" rel="stylesheet" />
<link href="~/Content/styles/anitmate.css" rel="stylesheet" />
<link href="~/Content/styles/style.css" rel="stylesheet" />

<link href="~/Content/scripts/plugins/tree/tree.css" rel="stylesheet" />
<link href="~/Content/scripts/plugins/jqgrid/jqgrid.css" rel="stylesheet" />
<script src="~/Content/scripts/plugins/tree/tree.js"></script>

<script src="/Content/scripts/plugins/validator/js?v=XgpF3bkqcHESsLip2j1dhS6n2I-zHyD2VCazpanqH6Q1"></script>
<script src="/Content/scripts/utils/js?v=FNqaC7G7A87_J4VCIQpQEAO-d_2Qf2wSxoZexwRzulo1"></script>
<script src="~/Content/scripts/plugins/jqgrid/jqgrid.js"></script>
<script src="~/Content/scripts/utils/UploadFile.js"></script>
<script src="~/Content/scripts/plugins/jquery.md5.js"></script>
<script src="~/Content/scripts/plugins/uploadify/ajaxfileupload.js"></script>

<script>
    var keyValue = request('keyValue');
    var billDetailId = "";
    var organizeid = "";
    var sourceType = request('sourceType'), sourceId = request('sourceId');
    var fileFilter = [];
    var IsTurn = 0;
    var list = [];
    var _length = 0;
    var img_index = 0;
    var img_src = "";
    $(function () {
        initControl();
        //计算居中位置
        var mg_top = ((parseInt($(window).height()) - parseInt($(".photo-div").height())) / 2);

        $(".photo-div").css({
            "margin-top": "" + mg_top + "px"
        });
        //关闭
        $(".photo-close").click(function () {
            $(".photo-mask").hide();
            $(".photo-panel").hide();
        });
        //下一张
        $(".photo-panel .photo-div .arrow-next").click(function () {
            img_index++;
            if (img_index >= $("#preview li img").length) {
                img_index = 0;
            }
            img_src = $("#preview li img").eq(img_index).attr("src");
            photoView($("#preview li img"));
        });
        //上一张
        $(".photo-panel .photo-div .arrow-prv").click(function () {
            img_index--;
            if (img_index < 0) {
                img_index = $("#preview li img").length - 1;
            }
            img_src = $("#preview li img").eq(img_index).attr("src");
            photoView($("#preview li img"));
        });
        //调用
        $("#preview li img").live("click", function () {
            $(".photo-mask").show();
            $(".photo-panel").show();
            img_src = $(this).attr("src");
            img_index = $(this).index();
            photoView($(this));
        });


    });

    //自适应预览
    function photoView(obj) {
        if ($(obj).width() >= $(obj).height()) {
            $(".photo-panel .photo-div .photo-img .photo-view-h").attr("class", "photo-view-w");
            $(".photo-panel .photo-div .photo-img .photo-view-w img").attr("src", img_src);
        } else {
            $(".photo-panel .photo-div .photo-img .photo-view-w").attr("class", "photo-view-h");
            $(".photo-panel .photo-div .photo-img .photo-view-h img").attr("src", img_src);
        }


    }
    //显示上传文件
    function SetFile(files) {
        if (files.length > 4) {
            dialogMsg("最多只能传4个附件", 0);
            return;
        }
        IMG = "";
        fileFilter = files;
        var _html = "<ul>";
        debugger;
        for (var i = 0; i < files.length; i++) {
            if (files[i]) {
                if (files[i].constructor.name == "File") {
                    _html += "<li><a  class='Del_Img' onclick='Del_Img(" + i + ");' title='删除' >x</a><img id='uploadImage_" + i + "' src='" + window.URL.createObjectURL(files[i]) + "' class='" + files[i].name + "'  /></li>";
                }
                else if (files[i].constructor.name == "Object") {
                    _html += "<li><a class='Del_Img' onclick='Del_Img(" + i + ");' title='删除'>x</a><img id='uploadImage_" + i + "' src='" + files[i].FileUrl + "'  class='" + files[i].name + "'  /></li>";
                }
            }

        }
        _html += "</ul>"
        $("#preview").html(_html);
        debugger;

    }
    function Del_Img(s) {
        fileFilter = $.grep(fileFilter, function (value) {
            return value != fileFilter[s];
        })
        var arrFile = [];
        for (var j = 0, fileb; fileb = fileFilter[j]; j++) {
            arrFile.push(fileb);

        }
        SetFile(arrFile);
    }



    function SetFileDisplay(dataArray) {
        var _html = "<ul>";
        if (dataArray.length > 0) {
            fileFilter = dataArray;
            for (var i = 0; i < dataArray.length; i++) {
                if (dataArray[i].Type == 41) {
                    _html += "<li><img id='uploadImage_" + i + "' src='" + dataArray[i].FileUrl + "' /></li>";
                }
            }
            _html += "</ul>";
            $("#preview").html(_html);

        }
    }
    //上传文件到后台
    function UploadFile() {
        $.ajaxFileUpload({
            url: "../../PropertyManage/CS_Complaints/UploadFile",
            secureuri: false,
            fileElementId: 'fileImage',
            dataType: 'json',
            success: function (data) {
                var files = document.getElementById('fileImage').files;
                var arrFile = [];
                if (files.length > 0) {
                    if (fileFilter.length > 0) {
                        for (var j = 0, fileb; fileb = fileFilter[j]; j++) {
                            arrFile.push(fileb);
                        }
                        for (var i = 0, filea; filea = files[i]; i++) {
                            var count = 0;
                            for (var j = 0, fileb; fileb = fileFilter[j]; j++) {
                                if (filea.name == fileb.name && filea.size == fileb.size) {
                                    count++;
                                }
                            }
                            if (count == 0) {
                                arrFile.push(filea);
                            }
                        }
                        SetFile(arrFile);
                    }
                    else {
                        SetFile(files);
                    }
                }
            }

        });
    }

    function initControl() {
        debugger;
        var Mode = "@ViewBag.Mode";
        if (Mode == "True") {
            $("#Code").attr("placeholder", "系统已启用自动编号").attr("disabled", "disabled");
        } else {
            $("#Code").attr("isvalid", "yes").attr("checkexpession", "NotNull").attr("placeholder", "请输入编号");
        }

        $("#OrganizeId").ComboBoxTree({
            url: "../../BaseManage/Organize/GetTreeJson",
            description: "==请选择所属机构==",
            height: "250px",
            click: function (data) {
                organizeid = data.id;
            }
        });
        $("#OrganizeId").ComboBoxTreeSetValue("@LeSoft.Application.Code.OperatorProvider.Provider.Current().CompanyId");
        //投诉方式
        $("#ComplaintWay").ComboBoxTree({
            url: "../../SystemManage/DataItemDetail/GetDataItemTreeJson",
            param: { EnCode: "ComplainWay" },
            description: "==请选择==",
            height: "200px"
        });

        //投诉类别
        $("#ComplaintType").ComboBoxTree({
            url: "../../SystemManage/DataItemDetail/GetDataItemTreeJson",
            param: { EnCode: "ComplainType" },
            description: "==请选择==",
            height: "200px"
        });

        //被投诉人类别
        $("#ComplaintedManType").ComboBox({
            data: [{ "key": 1, "value": "业户" }, { "key": 2, "value": "员工" }, { "key": 0, "value": "其他" }],
            id: "key",
            text: "value",
            description: null
        });
        $("#ComplaintedManType").ComboBoxSetValue(0);

        //是否立项操作
        $('input:radio[name="IsProjected"]').change(function (e) {

            if (e.currentTarget.value == "1") {
                $(".projectclass").removeAttr("hidden");
                $(".unproject").attr("hidden", "hidden");
                $("#ProjectedMemo").removeAttr("isvalid").removeAttr("checkexpession");
                $("#ProjectedDate").val("@LeSoft.Util.Time.GetToday("yyyy-MM-dd HH:mm:ss")");
                $("#ProjectedMan").attr("title", "@LeSoft.Application.Code.OperatorProvider.Provider.Current().UserId");
                $("#ProjectedMan").val("@LeSoft.Application.Code.OperatorProvider.Provider.Current().UserName");
                SetStatediv(true);
            }
            else {
                $(".unproject").removeAttr("hidden");
                $("#ProjectedMemo").attr("isvalid", "yes").attr("checkexpession", "NotNull");
                $("#TrWay").attr("hidden", "hidden");
                $(".projectclass").attr("hidden", "hidden");
                $("#ProjectedDate").val("");
                $("#ProjectedMan").attr("title", "");
                $("#ProjectedMan").val("");
                $("#Person").val("").removeAttr("title");
                SetStatediv(false);
            }
        });

        //派工方式
        $("#SendWay").ComboBox({
            data: [{ "key": 1, "value": "给派单人" }, { "key": 2, "value": "给执行人" }, { "key": 0, "value": "线下" }],
            id: "key",
            text: "value",
            description: null,
            click: function (e) {
                if (e.attr('data-value') != 0) {
                    $("#TrWay").removeAttr("hidden");
                    $(".completetr").attr("disabled", "disabled").val("").removeAttr("title");
                }
                else {
                    $("#TrWay").attr("hidden", "hidden");
                    $(".completetr").removeAttr("disabled");
                    $("#Person").val("").removeAttr("title");
                }
            }
        });
        $("#SendWay").ComboBoxSetValue(0);

        //回访方式
        $("#ReturnBackWay").ComboBox({
            data: [{ "key": 1, "value": "给回访任务" }, { "key": 2, "value": "客户线上评价" }, { "key": 0, "value": "线下" }],
            id: "key",
            text: "value",
            description: null,
            click: function (e) {
                if (e.attr('data-value') == 1) {
                    $(".ReturnMantd").removeAttr("hidden");
                    $(".returnclass").attr("disabled", "disabled");
                    $("#ReturnBackWay").removeAttr("disabled");
                    $("#ReturnBackManId").removeAttr("disabled");
                }
                else {
                    $(".ReturnMantd").attr("hidden", "hidden");
                    $(".returnclass").removeAttr("disabled");
                }
            }
        });
        $("#ReturnBackWay").ComboBoxSetValue(0);

        //状态
        SetStatediv($("[id =IsProjected]:checkbox").checked);
        $("#State").ComboBoxSetValue(1);

        if (!!sourceId) {
            $.SetForm({
                url: "../../PropertyManage/CS_LinkBill/GetFormJson",
                param: { keyValue: sourceId },
                success: function (data) {
                    $("#OrganizeId").ComboBoxTreeSetValue(data.data1.OrganizeId);
                    $("#PStructId").val(data.data1.Location);
                    $("#PStructId").attr("title", data.data1.PStructId);
                    $("#CustomerName").val(data.data1.CustomerName);
                    $("#CustomerName").attr("title", data.data1.CustomerId);
                    $("#ComplaintMan").val(data.data1.LinkMan).attr("title", data.data1.LinkManId);
                    $("#ComplaintPhone").val(data.data1.LinkPhone);
                    $("#ComplaintContent").val(data.data1.LinkContent);
                    $("#wizard-actions").removeAttr("hidden");
                    $("#State").ComboBoxSetValue(2);
                }
            });
        }
        if (!!keyValue) {
            $("#fileImage").attr("disabled", "disabled");
            $.SetForm({
                url: "../../PropertyManage/CS_Complaints/GetFormJson",
                param: { keyValue: keyValue },
                success: function (data) {
                    $("#form1").SetWebControls(data.data1);
                    SetFileDisplay(data.data3);
                    SetStatediv(data.data1.IsProjected);
                    $("#State").ComboBoxSetValue(data.data1.State);
                    $("#PStructId").val(data.data1.Location);
                    $("#PStructId").attr("title", data.data1.PStructId);
                    $("input[name='IsProjected'][value=" + data.data1.IsProjected + "]").attr("checked", true);
                    sourceType = data.data1.SourceType;
                    sourceId = data.data1.SourceId;

                    if (data.data2 != null) {
                        $("#form1").SetWebControls(data.data2);
                        billDetailId = data.data2.BillDetailId;
                        $("#SendWay").ComboBoxSetValue(data.data2.SendWay);
                        if (data.data2.SendWay == 1) $("#Person").attr("placeholder", data.data2.SendMan);
                        if (data.data2.SendWay == 2) $("#Person").attr("placeholder", data.data2.ReceiveMan);
                    }

                    //状态显隐藏
                    if (data.data1.State > 2) {
                        $("#ReturnBackManId").val(data.data2.ReturnBackMan).attr("title", data.data2.ReturnBackManId);
                        $(".BaseClass").attr("disabled", "disabled").removeAttr("onclick");
                        $(".projectclass").attr("disabled", "disabled").removeAttr("onclick");
                        $(".projectclass input").attr("disabled", "disabled");
                        $(".unproject").attr("disabled", "disabled");
                        if (data.IsSendWay && data.data2.SendWay == 1) {
                            $("#SendWay").removeAttr("disabled");//派工方式
                            $("#SendWay").ComboBox({
                                data: [{ "key": 1, "value": "给派单人" }, { "key": 2, "value": "给执行人" }],
                                id: "key",
                                text: "value",
                                description: null
                            });
                            $("#SendWay").ComboBoxSetValue(1);
                        }
                        if (!data.IsSendWay) { $("#Person").attr("disabled", "disabled").next().children().attr("disabled", "disabled").removeAttr("onclick"); }
                        $("#State").attr("disabled", "disabled");//状态不可编辑
                        if (data.data1.IsProjected == 1) { //立项
                            $(".projectclass").removeAttr("hidden");
                            $(".unproject").attr("hidden", "hidden");
                            if (data.data2.SendWay != 0) {//线上
                                $("#TrWay").removeAttr("hidden");
                                $(".completetr").attr("disabled", "disabled"); $("#BaseInfo a.completetr").removeAttr("onclick");
                                if (data.data1.State == 5 && data.IsDispose) $("#CompleteInfo .completetr").removeAttr("disabled");
                            }
                            else {
                                if (data.data1.State < 5) $("#TrWay").attr("hidden", "hidden");
                                if (data.data1.State < 6) $(".completetr").removeAttr("disabled");
                            }
                            if (data.data1.State > 5) { $("#BaseInfo a.completetr").removeAttr("onclick"); $("#Person").attr("disabled", "disabled").next().children().attr("disabled", "disabled").removeAttr("onclick"); }
                        }
                        else {
                            $(".unproject").removeAttr("hidden").attr("disabled", "disabled");
                            if (data.data1.State < 6 && data.data1.IsProjected != -1) $(".completetr").removeAttr("disabled");
                            else $(".completetr").attr("disabled", "disabled").removeAttr("onclick");
                        }
                        if (data.data2.ReturnBackWay == 1) { $(".returnclass").attr("disabled", "disabled"); if (data.IsReturn) $(".returnclass").removeAttr("disabled") }
                        if (data.data1.State > 5) { $(".completetr").attr("disabled", "disabled").removeAttr("onclick"); }
                        if (data.data1.State == 7) { $(".returnclass").attr("disabled", "disabled").removeAttr("onclick"); }

                    }
                }
            });
        }

    }

    //操作记录
    function getOperateGrid() {
        $gridTable = $("#gridTable_Operate");
        $gridTable.jqGrid({
            url: "../../SystemManage/Setting/GetOperateRecordList",
            postData: { BillId: keyValue },
            datatype: "json",
            height: 650,
            hidegrid: false,
            caption: "操作记录",
            autowidth: true,
            colModel: [
               { label: '项目主键', name: 'Id', hidden: true },
                        { label: '业务类别', name: 'Type', width: 100, align: 'center', sortable: false },
                        { label: '操作人', name: 'FromOperateName', width: 100, align: 'center', sortable: false },
                        { label: '操作时间', name: 'Date', width: 170, align: 'center', sortable: false },
                        {
                            label: "操作内容", name: "Content", index: "Content", width: 590, align: "left", sortable: false,
                            formatter: function (cellvalue, options, rowObject) {
                                if (!!rowObject.ToOperateName)
                                    return "发起者：" + rowObject.FromOperateName + "，接受者：" + rowObject.ToOperateName + "<br/>" + cellvalue;
                                else
                                    return "发起者：" + rowObject.FromOperateName + "<br/>" + cellvalue;
                            }
                        },
            ],
            viewrecords: true,
            rownumbers: true,

        });
    }
    function SetStatediv(flag) {
        if (flag) {
            $("#State").ComboBox({
                data: [{ "key": 1, "value": "未处理" }, { "key": 2, "value": "受理中" }, { "key": 3, "value": "未派单" }, { "key": 4, "value": "派单中" }, { "key": 5, "value": "处理中" }, { "key": 6, "value": "已完成未回访" }, { "key": 7, "value": "已完成已回访" }, { "key": 8, "value": "已取消" }],
                id: "key",
                text: "value"
            });
        }
        else {
            $("#State").ComboBox({
                data: [{ "key": 1, "value": "未处理" }, { "key": 2, "value": "受理中" }, { "key": 3, "value": "未派单" }, { "key": 4, "value": "派单中" }, { "key": 5, "value": "处理中" }, { "key": 6, "value": "已完成未回访" }, { "key": 7, "value": "已完成已回访" }, { "key": 8, "value": "已取消" }],
                id: "key",
                text: "value",
                click: function (e) {
                    if (e.attr('data-value') == 7) {
                        //$('#unhandle').removeAttr("hidden");
                        $(".completetr").attr("disabled", "disabled");
                        $('#State').removeAttr("disabled");
                    }
                    else {
                        $(".completetr").removeAttr("disabled");
                        //$('#unhandle').attr("hidden", "hidden");
                    }
                }
                //description: "==请选择=="
            });
        }
    }

    //保存表单
    function AcceptClick() {
        if (!$('#form1').Validform()) {
            return false;
        }
        if (!$("#Date").val()) { dialogMsg("单据时间不允许为空", 0); return false; }
        var postData = $("#form1").GetWebControls(keyValue);
        postData["PStructId"] = $("#PStructId").attr('title');
        postData["Location"] = $("#PStructId").val();
        postData["CustomerId"] = $("#CustomerName").attr('title');
        postData["ComplaintManId"] = $("#ComplaintMan").attr('title');
        postData["ComplaintedManId"] = $("#ComplaintedMan").attr('title');
        postData["SourceType"] = !!sourceType ? sourceType : 0;
        postData["SourceId"] = sourceId;
        postData["IsProjected"] = $('#IsProjected input[name="IsProjected"]:checked ').val();
        if (!postData["IsProjected"]) {
            postData["IsProjected"] = -1;
        }
        postData["SendWay"] = $('#SendWay').attr('data-value');
        if (postData["SendWay"] == 1) {
            //派给派单人
            postData["SendManId"] = $("#Person").attr("title");
            postData["SendMan"] = $("#Person").val();
        }
        else if (postData["SendWay"] == 2) {
            //派给执行人
            postData["SendManId"] = "@LeSoft.Application.Code.OperatorProvider.Provider.Current().UserId";
            postData["SendMan"] = "@LeSoft.Application.Code.OperatorProvider.Provider.Current().UserName";
            postData["SendDate"] = "@LeSoft.Util.Time.Now.Date";
            postData["ReceiveMan"] = $("#Person").val();
            postData["ReceiveManId"] = $("#Person").attr("title");
        }
        postData["IsSendMessage"] = $('#IsSendMessage input[name="IsSendMessage"]:checked ').val();
        postData["BillId"] = keyValue;
        postData["BillDetailId"] = billDetailId;
        postData["ExecManId"] = $("#ExecMan").attr("title");
        if (postData["ReturnBackWay"] == 1) {
            postData["ReturnBackMan"] = $("#ReturnBackManId").val();
            postData["ReturnBackManId"] = $("#ReturnBackManId").attr("title");
        }
        if ($("#ReturnBackMan").val() != "" && $("#ReturnBackDate").val() != "") {
            postData["ReturnBackMark"] = 1;
        }

        var ImgData = [];
        $("#preview img").each(function () {
            if (!!$(this).attr("class")) {
                ImgData.push({
                    Name: $(this).attr("class")
                })
            }
        });

        $.SaveForm({
            url: "../../PropertyManage/CS_Complaints/SaveForm?keyValue=" + keyValue + "&IMG=" + JSON.stringify(ImgData),
            param: postData,
            loading: "正在保存数据...",
            success: function () {
                $.currentIframe().$("#gridTable").resetSelection();
                $.currentIframe().$("#gridTable").trigger("reloadGrid");
            }
        })
    }
    function DataItemSelect(type) {
        if ($("#OrganizeId").attr('data-value') == undefined) {
            dialogMsg("请先选择机构", 0);
        } else {
            var options = {};
            switch (type) {
                case 1: {
                    var data = [{ id: "PStructId", text: "", value: "" }, { id: "CustomerName", text: "", value: "" }, { id: "ComplaintMan", text: "", value: "" }, { id: "ComplaintPhone", text: "", value: "" }];
                    options = {
                        category: 2,
                        type: 1,
                        organizeid: $("#OrganizeId").attr('data-value'),
                        data: data
                    };
                }; break;
                case 2: {
                    var t = $('#ComplaintedManType').attr('data-value');
                    if (t == "1") {
                        var data = [{ id: "ComplaintedMan", text: "", value: "" }, { id: "ComplaintedPhone", text: "", value: "" }];
                        options = {
                            category: 2,
                            type: 1,
                            organizeid: $("#OrganizeId").attr('data-value'),
                            data: data
                        };
                    }
                    else if (t == "2") {
                        var data = [{ id: "ComplaintedMan", text: "", value: "" }, { id: "ComplaintedPhone", text: "", value: "" }];
                        options = {
                            category: 2,
                            type: 3,
                            organizeid: $("#OrganizeId").attr('data-value'),
                            data: data
                        };
                    }
                    else {
                        dialogMsg("请输入被投诉人信息，或更改被投诉人类别", 0);
                        return false;
                    }
                }; break;
                case 3: {
                    var data = [{ id: "ProjectedMan", text: "", value: "" }];
                    options = {
                        category: 22,
                        type: 3,
                        organizeid: $("#OrganizeId").attr('data-value'),
                        data: data
                    };

                }; break;
                case 4: {
                    var t = $('#SendWay').attr('data-value');
                    if (t == "1") {//派单人
                        var data = [{ id: "Person", text: "", value: "" }];
                        options = {
                            category: 21,
                            type: 3,
                            organizeid: $("#OrganizeId").attr('data-value'),
                            data: data
                        };
                    }
                    else if (t == "2") {//处理人
                        var data = [{ id: "Person", text: "", value: "" }];
                        options = {
                            category: 23,
                            type: 3,
                            organizeid: $("#OrganizeId").attr('data-value'),
                            data: data
                        };
                    }
                    else {
                        dialogMsg("请输入信息，或更改派工方式", 0);
                        return false;
                    }

                }; break;
                case 5: {//派单人
                    var data = [{ id: "SendMan", text: "", value: "" }];
                    options = {
                        category: 21,
                        type: 3,
                        organizeid: $("#OrganizeId").attr('data-value'),
                        data: data
                    };

                }; break;
                case 6: {//处理人
                    var data = [{ id: "ReceiveMan", text: "", value: "" }];
                    options = {
                        category: 23,
                        type: 3,
                        organizeid: $("#OrganizeId").attr('data-value'),
                        data: data
                    };
                }; break;
                case 7: {//完成
                    var data = [{ id: "ExecMan", text: "", value: "" }];
                    options = {
                        category: 23,
                        type: 3,
                        organizeid: $("#OrganizeId").attr('data-value'),
                        data: data
                    };

                }; break;
                case 8: {//回访
                    var data = [{ id: "ReturnBackManId", text: "", value: "" }];
                    options = {
                        category: 24,
                        type: 3,
                        organizeid: $("#OrganizeId").attr('data-value'),
                        data: data
                    };
                }; break;
            }
            DataItemClick(JSON.stringify(options));
        }
    }
</script>

<div id="wrapper" style="background:#fff;">
    <div id="left-side">
        <ul>
            <li class="choose active">
                制单派单
            </li>
            <li class="pay">
                处理投诉
            </li>
            <li class="wrap">
                业务日志
            </li>
        </ul>
    </div>
    <div id="border">
        <div id="line" class="one"></div>
    </div>
    <div id="right-side" class="tab-content">
        <div id="first" class="tab-pane active" style="max-height: 720px; overflow-y: scroll;">
            <div id="BaseInfo" style=" margin-right: 15px">
                <table class="form">
                    <tr>
                        <td class="formTitle">所属机构<font face="宋体">*</font></td>
                        <td class="formValue">
                            <div id="OrganizeId" type="selectTree" class="ui-select BaseClass" isvalid="yes" checkexpession="NotNull"></div>
                        </td>
                        <th class="formTitle">单据编号<font face="宋体">*</font></th>
                        <td class="formValue">
                            <input id="Code" type="text" onblur="$.ExistField(this.id,'../../PropertyManage/CS_Decorate/ExistCode')" class="form-control BaseClass" placeholder="系统已启用自动编号" isvalid="yes" />
                        </td>
                        <th class="formTitle">单据日期<font face="宋体">*</font></th>
                        <td class="formValue">
                            <input id="Date" type="text" class="form-control input-wdatepicker BaseClass" placeholder="请输入单据日期" value="@LeSoft.Util.Time.GetToday("yyyy-MM-dd HH:mm:ss")" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss' })" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">投诉方式<font face="宋体">*</font></th>
                        <td class="formValue">
                            <div id="ComplaintWay" type="selectTree" class="ui-select BaseClass" isvalid="yes" checkexpession="NotNull"></div>
                        </td>
                        <th class="formTitle">投诉类别<font face="宋体">*</font></th>
                        <td class="formValue">
                            <div id="ComplaintType" type="selectTree" class="ui-select BaseClass" isvalid="yes" checkexpession="NotNull"></div>
                        </td>
                        <th class="formTitle"></th>
                        <td class="formValue"></td>
                    </tr>
                    <tr>
                        <th class="formTitle">投诉人房屋<font face="宋体">*</font></th>
                        <td class="formValue" colspan="3">
                            <div class="input-group" style="width: 100%;">
                                <input id="PStructId" type="text" class="form-control BaseClass" isvalid="yes" checkexpession="NotNull">
                                <span class="input-group-btn BaseClass">
                                    <a onclick="DataItemSelect(1)" class="form-control BaseClass" style="cursor: pointer"><i class="fa fa fa-book " style=" font-size: 20px; padding-right: 5px; padding-top: 3px; color: gray"></i></a>
                                </span>
                            </div>
                        </td>
                        <th class="formTitle">业户名称</th>
                        <td class="formValue">
                            <input id="CustomerName" type="text" class="form-control BaseClass" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">投诉人<font face="宋体">*</font></th>
                        <td class="formValue">
                            <div class="input-group" style="width: 100%;">
                                <input id="ComplaintMan" type="text" class="form-control BaseClass" isvalid="yes" checkexpession="NotNull" />
                            </div>
                        </td>
                        <th class="formTitle">联系电话<font face="宋体">*</font></th>
                        <td class="formValue">
                            <input id="ComplaintPhone" type="text" class="form-control BaseClass" isvalid="yes" checkexpession="NotNull" />
                        </td>
                        <th class="formTitle">要求完成日期</th>
                        <td class="formValue">
                            <input id="ExpectDate" type="text" class="form-control input-wdatepicker BaseClass" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss' })" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">被投诉人类别<font face="宋体">*</font></th>
                        <td class="formValue">
                            <div id="ComplaintedManType" type="selectTree" class="ui-select BaseClass" isvalid="yes" checkexpession="NotNull"></div>
                        </td>
                        <th class="formTitle"></th>
                        <td class="formValue"></td>
                        <th class="formTitle"></th>
                        <td class="formValue"></td>
                    </tr>
                    <tr>
                        <th class="formTitle">被投诉人<font face="宋体">*</font></th>
                        <td class="formValue" colspan="3">
                            <div class="input-group" style="width: 100%;">
                                <input id="ComplaintedMan" type="text" class="form-control BaseClass" isvalid="yes" checkexpession="NotNull">
                                <span class="input-group-btn">
                                    <a onclick="DataItemSelect(2)" class="form-control BaseClass" style="cursor: pointer"><i class="fa fa fa-book" style=" font-size: 20px; padding-right: 5px; padding-top: 3px; color: gray"></i></a>
                                </span>
                            </div>
                        </td>
                        <th class="formTitle">联系电话</th>
                        <td class="formValue">
                            <input id="ComplaintedPhone" type="text" class="form-control BaseClass" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle" valign="top" style="padding-top: 4px;">
                            投诉内容<font face="宋体">*</font>
                        </th>
                        <td class="formValue" colspan="5">
                            <textarea id="ComplaintContent" class="form-control BaseClass" style="height: 50px;" isvalid="yes" checkexpession="NotNull"></textarea>
                        </td>
                    </tr>
                    <tr style=" height: 20px; border-bottom: 1px dashed #cecece;"><td colspan="6"></td> </tr>
                    <tr>
                        <td colspan="6">
                            <div class="box" style=" height: 100px;">
                                <img style="position: relative; float: left; width: 60px; height: 60px;" src="~/Content/images/icon_app_add.png" />
                                <input id="fileImage" type="file" size="30" onchange="UploadFile()" name="fileselect[]" accept="image/png,image/gif,image/jpeg" multiple style="position: absolute; width: 60px; height: 60px; opacity: 0;" />
                                <div id="preview" style=" margin-left: 13px;">
                                </div>
                                <div class="photo-mask"></div>
                                <div class="photo-panel">
                                    <div class="photo-div">
                                        <div class="photo-left">
                                            <div class="arrow-prv"></div>
                                        </div>
                                        <div class="photo-img">
                                            <div class="photo-bar">
                                                <div class="photo-close"></div>
                                            </div>
                                            <div class="photo-view-h">
                                                <img src="" />
                                            </div>
                                        </div>
                                        <div class="photo-right">
                                            <div class="arrow-next"></div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr style=" height: 0px; border-bottom: 1px dashed #cecece;"><td colspan="6"></td> </tr>
                    <tr>
                        <th class="formTitle">是否立项</th>
                        <td class="formValue">
                            <div id="IsProjected" class="radio projectclass"><label><input name="IsProjected" type="radio" value="1" />立项</label><label> <input name="IsProjected" type="radio" value="0" />不立项</label></div>
                        </td>
                        <th class="formTitle projectclass" hidden>立项时间:</th>
                        <td class="formValue projectclass " hidden>
                            <input id="ProjectedDate" type="text" class="form-control input-wdatepicker projectclass" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss' })" />
                        </td>
                        <th class="formTitle projectclass" hidden>立项人:</th>
                        <td class="formValue projectclass" hidden>
                            <div class="input-group" style="width: 100%;">
                                <input id="ProjectedMan" type="text" class="form-control projectclass">
                                <span class="input-group-btn">
                                    <a onclick="DataItemSelect(3)" class="form-control projectclass" style="cursor: pointer"><i class="fa fa fa-book" style=" font-size: 20px; padding-right: 5px; padding-top: 3px; color: gray"></i></a>
                                </span>
                            </div>
                        </td>
                    </tr>
                    <tr class="unproject" hidden="hidden">
                        <th class="formTitle">不立项原因<font face="宋体">*</font></th>
                        <td colspan="5">
                            <textarea id="ProjectedMemo" class="form-control unproject" style="height: 50px;"></textarea>
                        </td>
                    </tr>
                    <tr style="background: #B1ddff;">
                        <th class="formTitle">完成状态:</th>
                        <td class="formValue">
                            <div id="State" type="selectTree" class="ui-select" disabled="disabled"></div>
                        </td>
                        <th class="formTitle projectclass" hidden>派工方式:</th>
                        <td class="formValue">
                            <div id="SendWay" type="selectTree " hidden class="ui-select projectclass"></div>
                        </td>
                        <td colspan="2" align="center">
                            @*<a id="lr-add" class="btn btn-success btn-xl" onclick="btn_add_repair()"><i class="fa fa-print"></i>&nbsp;提交并打印</a>*@
                        </td>
                    </tr>
                    <tr hidden style="background: #B1ddff;" id="TrWay">
                        <th class="formTitle">派给:</th>
                        <td class="formValue" colspan="3">
                            <div class="input-group" style="width: 100%;">
                                <input id="Person" type="text" class="form-control ">
                                <span class="input-group-btn">
                                    <a onclick="DataItemSelect(4)" class="form-control " style="cursor: pointer"><i class="fa fa fa-book" style=" font-size: 20px; padding-right: 5px; padding-top: 3px; color: gray"></i></a>
                                </span>
                            </div>
                        </td>
                        <th class="formTitle" hidden>发送消息通知:</th>
                        <td class="formValue" hidden>
                            <div id="IsSendMessage" class="radio"><label><input name="IsSendMessage" type="radio" value="1" />发送</label><label> <input name="IsSendMessage" type="radio" checked="checked" value="0" />不发送</label></div>
                        </td>
                    </tr>
                    <tr style=" height: 0px; border-bottom: 1px dashed #cecece;"><td colspan="6"></td> </tr>
                    <tr hidden id="unhandle">
                        <th class="formTitle ">不处理原因</th>
                        <td colspan="5">
                            <textarea id="Memo" class="form-control" style="height: 50px;"></textarea>
                        </td>
                    </tr>
                    <tr class="projectclass" hidden>
                        <th class="formTitle">派单时间:</th>
                        <td class="formValue">
                            <input id="SendDate" type="text" class="form-control input-wdatepicker completetr" placeholder="请输入派单时间" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss' })" />
                        </td>
                        <th class="formTitle">派单人:</th>
                        <td class="formValue">
                            <div class="input-group" style="width: 100%;">
                                <input id="SendMan" type="text" class="form-control completetr" placeholder="请输入派单人">
                                <span class="input-group-btn">
                                    <a onclick="DataItemSelect(5)" class="form-control completetr" style="cursor: pointer"><i class="fa fa fa-book" style=" font-size: 20px; padding-right: 5px; padding-top: 3px; color: gray"></i></a>
                                </span>
                            </div>
                        </td>
                    </tr>
                    <tr class="projectclass" hidden>
                        <th class="formTitle">接单时间:</th>
                        <td class="formValue">
                            <input id="ReceiveDate" type="text" class="form-control input-wdatepicker completetr" placeholder="请输入接单时间" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss' })" />
                        </td>
                        <th class="formTitle">接单人:</th>
                        <td class="formValue">
                            <div class="input-group" style="width: 100%;">
                                <input id="ReceiveMan" type="text" placeholder="请输入接单人" class="form-control completetr">
                                <span class="input-group-btn">
                                    <a onclick="DataItemSelect(6)" class="form-control completetr" style="cursor: pointer"><i class="fa fa fa-book" style=" font-size: 20px; padding-right: 5px; padding-top: 3px; color: gray"></i></a>
                                </span>
                            </div>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        <div id="second" class="tab-pane">
            <div id="CompleteInfo" style=" margin-right: 15px">
                <table class="form">
                    <tr>
                        <th class="formTitle" valign="top" style="padding-top: 4px;">
                            处理过程:
                        </th>
                        <td class="formValue" colspan="5">
                            <textarea id="ExecProcessing" class="form-control completetr" style="height: 50px;"></textarea>
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">完成时间<font face="宋体">*</font></th>
                        <td class="formValue">
                            <input id="ExecDate" type="text" class="form-control input-wdatepicker completetr" placeholder="请输入完成时间" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss' })" />
                        </td>
                        <th class="formTitle">完成人<font face="宋体">*</font></th>
                        <td class="formValue">
                            <div class="input-group" style="width: 100%;">
                                <input id="ExecMan" type="text" class="form-control completetr">
                                <span class="input-group-btn">
                                    <a onclick="DataItemSelect(7)" class="form-control completetr" style="cursor: pointer"><i class="fa fa fa-book" style=" font-size: 20px; padding-right: 5px; padding-top: 3px; color: gray"></i></a>
                                </span>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle" valign="top" style="padding-top: 4px;">
                            处理结果:
                        </th>
                        <td class="formValue" colspan="5">
                            <textarea id="ExecMemo" class="form-control completetr" style="height: 50px;"></textarea>
                        </td>
                    </tr>
                    <tr style=" height: 10px; border-bottom: 1px dashed #cecece;"><td colspan="6"></td> </tr>
                    <tr>
                        <th class="formTitle">客户满意度</th>
                        <td class="formValue">
                            <input id="CustomerLevel" type="text" class="form-control completetr" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">客户意见</th>
                        <td class="formValue" colspan="5">
                            <textarea id="CustomerComent" class="form-control completetr" style="height: 50px;"></textarea>
                        </td>
                    </tr>
                    <tr style="background: #B1ddff;">
                        <th class="formTitle">回访方式:</th>
                        <td class="formValue">
                            <div id="ReturnBackWay" type="selectTree" class="ui-select  returnclass"></div>
                        </td>
                        <th class="formTitle ReturnMantd" hidden>回访/检验人:</th>
                        <td class="formValue ReturnMantd" hidden>
                            <div class="input-group" style="width: 100%;">
                                <input id="ReturnBackManId" type="text" class="form-control returnclass">
                                <span class="input-group-btn">
                                    <a onclick="DataItemSelect(8)" class="form-control returnclass" style="cursor: pointer"><i class="fa fa fa-book" style=" font-size: 20px; padding-right: 5px; padding-top: 3px; color: gray"></i></a>
                                </span>
                            </div>
                        </td>
                        <td colspan="2" align="center">
                            @*<a id="lr-add" class="btn btn-success btn-xl" onclick="btn_add_repair()"><i class="fa fa-print"></i>&nbsp;回访检验</a>*@
                        </td>
                    </tr>
                    <tr style=" height: 10px; border-bottom: 1px dashed #cecece;"><td colspan="6"></td> </tr>
                    <tr>
                        <th class="formTitle">回访/检验人:</th>
                        <td class="formValue">
                            <input id="ReturnBackMan" type="text" class="form-control returnclass" />
                        </td>
                        <th class="formTitle">回访/检验时间:</th>
                        <td class="formValue">
                            <input id="ReturnBackDate" type="text" class="form-control input-wdatepicker returnclass" placeholder="请输入选择时间" onfocus="WdatePicker()" />
                        </td>
                        <th class="formTitle">客户评价/是否合格</th>
                        <td class="formValue">
                            <input id="CustomerRBLevel" type="text" class="form-control returnclass" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle" valign="top" style="padding-top: 4px;">
                            回访/检验情况:
                        </th>
                        <td class="formValue" colspan="5">
                            <textarea id="ReturnBackMemo" class="form-control returnclass" style="height: 50px;"></textarea>
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle" valign="top" style="padding-top: 4px;">
                            不满意原因:
                        </th>
                        <td class="formValue" colspan="5">
                            <textarea id="CustomerMemo" class="form-control returnclass" style="height: 50px;"></textarea>
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle" valign="top" style="padding-top: 4px;">
                            客户建议:
                        </th>
                        <td class="formValue" colspan="5">
                            <textarea id="CustomerRBComent" class="form-control returnclass" style="height: 50px;"></textarea>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        <div id="third" class="tab-pane" style="    max-height: 762px;overflow-y: scroll;">
            <div class="gridPanel">
                <table id="gridTable_Operate"></table>
            </div>
        </div>
    </div>
    <div class="form-button" id="wizard-actions" hidden>
        <a id="btn_save" class="btn  btn-success" onclick="AcceptClick();">确认</a>
        <a id="btn_submit" class="btn btn-danger" onclick="dialogClose()">关闭</a>
    </div>
    <script>

        $('.choose').click(function () {
            $('.choose').addClass('active');
            $('.pay').removeClass('active');
            $('.wrap').removeClass('active');
            $('.ship').removeClass('active');
            $('#line').addClass('one');
            $('#line').removeClass('two');
            $('#line').removeClass('three');
            $('#line').removeClass('four');
            $('#first').addClass('active');
            $('#second').removeClass('active');
            $('#third').removeClass('active');
            $('#fourth').removeClass('active');
            $("#right-side table").css("margin", "15px 0px");
        });
        $('.pay').click(function () {
            $('.pay').addClass('active');
            $('.choose').removeClass('active');
            $('.wrap').removeClass('active');
            $('.ship').removeClass('active');
            $('#line').addClass('two');
            $('#line').removeClass('one');
            $('#line').removeClass('three');
            $('#line').removeClass('four');
            $('#first').removeClass('active');
            $('#second').addClass('active');
            $('#third').removeClass('active');
            $('#fourth').removeClass('active');
            $("#right-side table").css("margin", "15px 0px");
        });
        $('.wrap').click(function () {
            $('.wrap').addClass('active');
            $('.pay').removeClass('active');
            $('.choose').removeClass('active');
            $('.ship').removeClass('active');
            $('#line').addClass('three');
            $('#line').removeClass('two');
            $('#line').removeClass('one');
            $('#line').removeClass('four');
            $('#first').removeClass('active');
            $('#second').removeClass('active');
            $('#third').addClass('active');
            $('#fourth').removeClass('active');
            $("#right-side table").css("margin", "0px");
            getOperateGrid(); 
        });
        $('.ship').click(function () {
            $('.ship').addClass('active');
            $('.pay').removeClass('active');
            $('.wrap').removeClass('active');
            $('.choose').removeClass('active');
            $('#line').addClass('four');
            $('#line').removeClass('two');
            $('#line').removeClass('three');
            $('#line').removeClass('one');
            $('#first').removeClass('active');
            $('#second').removeClass('active');
            $('#third').removeClass('active');
            $('#fourth').addClass('active');
            $("#right-side table").css("margin", "15px 0px");
        });


    </script>

</div>
